from typing import List, Optional

from pydantic import BaseModel

class QueryRequest(BaseModel):
    text: str
    session_id: str

class DocRequest(BaseModel):
    text: str
    created_by: str = "admin"

class DelRequest(BaseModel):
    doc_ids: List[str]

class DelCtRequest(BaseModel):
    sender_id: str
    rec_id: str

class AddTextsRequest(BaseModel):
    texts: Optional[List[str]] = None
    questions: Optional[List[str]] = None
    answers: Optional[List[str]] = None
    created_by: str = "api_user"
    category: str = "general"
    source: str = "api"
    product_type: str = "qnn_zd"
    valid_from: Optional[str] = None
    valid_to: Optional[str] = "2099-12-31"

class  UpdateTextsRequest(AddTextsRequest):
    doc_id:str

class DocumentResponse(BaseModel):
    content: str
    metadata: dict

class RAGResponse(BaseModel):
    answer: str
    sources: list[DocumentResponse]